package cn.bellychang.ood.srp.good;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ChangLiang
 * @date 2020/5/12
 */
public class Student {

    private String id;

    private String name;

    /**
     * 此学生已经上过的课程
     */
    private List<Course> coursesAlreadyTaken = new ArrayList<>();

    public List<Course> getCoursesAlreadyTaken() {
        return coursesAlreadyTaken;
    }

    // 将CourseService的逻辑进行划分 这里承担一部分
    public boolean canAttend(Course course){
        return this.coursesAlreadyTaken.containsAll(
                course.getPrerequisites());
    }
}
